package com.hugy.apollo.controller;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/apollo")
public class ApolloController {

    @Value("${spring.data.mongodb.port:11111}")
    private String port1;
    @Value("${server.port:8100}")
    private String port2;


    @GetMapping("/hello")
    public String hello(){
        Config config1 = ConfigService.getAppConfig();
        Config config2 = ConfigService.getConfig("TEST1.hei.public");
        String str2 = config2.getProperty("spring.data.mongodb.port","11111");
        String str = config1.getProperty("server.port", "8100");
        return str;
    }
}
